CPP=g++

PLUGIN_NAME = encoder

PLUGIN_FILES = encoder.cpp
PLUGIN_OBJECTS	= $(PLUGIN_FILES:%.cpp=%.o)

PLUGIN_COMPILE_FLAGS = -fPIC -Wall -O2
PLUGIN_LINK_FLAGS = -shared -Wl,-soname,libplug$(PLUGIN_NAME).so -o libplug$(PLUGIN_NAME).so $(shell pkg-config --libs opencv) -lc

%.o: %.cpp
	$(CPP) $(PLUGIN_COMPILE_FLAGS) -c -o $@  $< 

all: $(PLUGIN_OBJECTS)
	$(CPP) $(PLUGIN_LINK_FLAGS) $(PLUGIN_OBJECTS) ;\

system: all
	cp libplug$(PLUGIN_NAME).so ../../../build

clean:
	rm *.so
	rm *.o
